﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDebug>
#include <QString>
#include <QJsonObject>
#include <api_user.h>
#include <QMessageBox>
#include <api_chef.h>
#include <api_client.h>
#include <api_cooked_food_list.h>
#include <api_food.h>
#include <api_food_style.h>
#include <api_manager.h>
#include <api_order.h>
#include <api_order_item.h>
#include <api_review.h>
#include <api_server.h>
#include <api_table.h>
#include <api_undo_food.h>
#include <api_warehouse.h>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private slots:
    void on_window_close_btn_clicked();

    void on_window_to_user_login_btn_clicked();

    void on_window_to_user_register_btn_clicked();

    void on_login_confirm_login_btn_clicked();

    void on_register_confirm_register_btn_clicked();

    void handle_user_login_finished();

    void handle_user_register_finished();

    void handle_user_get_cur_user_info_finished();

    void on_navbar_top_user_info_btn_clicked();

    void on_navbar_top_destroyed();

    void on_navbar_top_tabBarClicked(int index);

    void on_navbar_top_currentChanged(int index);

    void on_navbar_top_tab_01_client_order_btn_clicked();

    void on_navbar_top_tab_01_client_review_btn_clicked();

    void on_navbar_top_tab_01_client_order_history_btn_clicked();

    void on_navbar_top_tab_01_client_info_btn_clicked();

    void on_navbar_top_tab_02_server_notice_btn_clicked();

    void on_navbar_top_tab_02_server_money_btn_clicked();

    void on_navbar_top_tab_02_server_info_btn_clicked();

    void on_navbar_top_tab_03_chef_material_btn_clicked();

    void on_navbar_top_tab_03_chef_food_manage_btn_clicked();

    void on_navbar_top_tab_03_chef_todo_btn_clicked();

    void on_navbar_top_tab_03_chef_work_btn_clicked();

    void on_navbar_top_tab_04_manager_table_manage_btn_clicked();

    void on_navbar_top_tab_04_manager_performance_btn_clicked();

    void on_navbar_top_tab_04_manager_food_rank_btn_clicked();

    void on_navbar_top_tab_04_manager_server_rank_btn_clicked();

    void on_navbar_top_logout_btn_clicked();

    void on_navbar_top_tab_03_chef_info_btn_clicked();

    void on_add_select_food_btn_clicked();

    void on_delete_select_food_btn_clicked();

    void on_buy_food_sub_order_btn_clicked();

    void on_confirm_check_out_btn_clicked();

    void on_confirm_done_btn_clicked();

signals:
//    void get_cur_user_info_finished();

public:
    // 清空信息相关的函数
    void empty_login_box();
    void empty_register_box();
    void empty_navbar_top();

    // 组件隐藏相关的函数
    void hide_navbar_side_01();

    // 组件隐藏相关的函数
    void show_navbar_side_01();

    // 登录后获取信息
    void get_cur_user_info(QString token, int uid);

    void get_cur_user_info_finished();
    void handle_send_order_finished();
    void handle_get_all_order_by_client_id();
    void handle_get_all_unpaid_order();
    void handle_check_out();
    void handle_done();
    void handle_get_all_unfinished();

private:
    Ui::Widget *ui;

public:
    void switch_current_page(int i);

    User *user = new User();
    Chef *chef = new Chef();
    Client *client = new Client();
    CookedFoodList *cookedFoodList = new CookedFoodList();
    Food *food = new Food();
    FoodStyle *foodStyle = new FoodStyle();
    Manager *manager = new Manager();
    Order *order = new Order();
    OrderItem *orderItem = new OrderItem();
    Review *review = new Review();
    Server *server = new Server();
    Table *table = new Table();
    UndoFood *undoFood = new UndoFood();
    Warehouse *warehouse = new Warehouse();
};

#endif // WIDGET_H
